﻿using System.Data;
using System.Threading.Tasks;
using JX.Core;
using JX.Core.Entity;

namespace JX.Application
{
	/// <summary>
	/// 数据库表：Company 的应用层服务接口.
	/// </summary>
	public partial interface ICompanyServiceAppDapper : IServiceAppDapper<CompanyEntity>
	{
		#region 添加
		/// <summary>
		/// 添加公司与扩展
		/// </summary>
		/// <param name="entity"></param>
		/// <returns></returns>
		bool AddFull(CompanyEntity entity);
		/// <summary>
		/// 添加公司与扩展
		/// </summary>
		/// <param name="entity"></param>
		/// <returns></returns>
		Task<bool> AddFullAsync(CompanyEntity entity);
		#endregion

		#region 修改
		/// <summary>
		/// 修改公司与扩展
		/// </summary>
		/// <param name="entity"></param>
		/// <returns></returns>
		bool UpdateFull(CompanyEntity entity);
		/// <summary>
		/// 修改公司与扩展
		/// </summary>
		/// <param name="entity"></param>
		/// <returns></returns>
		Task<bool> UpdateFullAsync(CompanyEntity entity);
		#endregion

		#region 删除
		/// <summary>
		/// 删除企业及相关用户数据
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		bool DeleteFull(int id);
		/// <summary>
		/// 删除企业及相关用户数据
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		Task<bool> DeleteFullAsync(int id);
		/// <summary>
		/// 删除企业及相关用户数据
		/// </summary>
		/// <param name="ids"></param>
		/// <returns></returns>
		void DeleteFull(string ids);
		/// <summary>
		/// 删除企业及相关用户数据
		/// </summary>
		/// <param name="ids"></param>
		/// <returns></returns>
		Task DeleteFullAsync(string ids);
		#endregion

		#region 移出会员
		/// <summary>
		/// 从企业中移出会员
		/// </summary>
		/// <param name="companyId"></param>
		/// <returns></returns>
		bool RemoveUsers(int companyId);
		/// <summary>
		/// 从企业中移出会员
		/// </summary>
		/// <param name="companyId"></param>
		/// <returns></returns>
		Task<bool> RemoveUsersAsync(int companyId);
		#endregion

		#region 是否存在扩展数据
		/// <summary>
		/// 是否存在扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="tableName"></param>
		/// <returns></returns>
		bool IsExistDataOption(int id, string tableName = "U_CompanyText");
		/// <summary>
		/// 是否存在扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="tableName"></param>
		/// <returns></returns>
		Task<bool> IsExistDataOptionAsync(int id, string tableName = "U_CompanyText");
		#endregion

		#region 添加扩展数据
		/// <summary>
		/// 添加扩展数据:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		bool AddDataOption(string tableName, CompanyEntity entity);
		/// <summary>
		/// 添加扩展数据:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		Task<bool> AddDataOptionAsync(string tableName, CompanyEntity entity);
		#endregion

		#region 修改扩展数据
		/// <summary>
		/// 修改扩展表数据，不存在则添加:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		bool UpdateDataOption(string tableName, CompanyEntity entity);
		/// <summary>
		/// 修改扩展表数据，不存在则添加:从entity.Fields中获取表列及列值信息
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="entity"></param>
		/// <returns></returns>
		Task<bool> UpdateDataOptionAsync(string tableName, CompanyEntity entity);
		#endregion

		#region 删除扩展数据
		/// <summary>
		/// 删除扩展数据
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="id"></param>
		/// <returns></returns>
		bool DeleteDataOption(string tableName, int id);
		/// <summary>
		/// 删除扩展数据
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="id"></param>
		/// <returns></returns>
		Task<bool> DeleteDataOptionAsync(string tableName, int id);
		#endregion

		#region 得到扩展数据
		/// <summary>
		/// 根据主键得到扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		DataTable GetDataOption(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		/// <summary>
		/// 根据主键得到扩展数据
		/// </summary>
		/// <param name="id"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		Task<DataTable> GetDataOptionAsync(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		#endregion

		#region 得到公司成员
		/// <summary>
		/// 根据主键得到公司成员
		/// </summary>
		/// <param name="id">公司ID</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		DataTable GetMemberInfo(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		/// <summary>
		/// 根据主键得到公司成员
		/// </summary>
		/// <param name="id">公司ID</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		Task<DataTable> GetMemberInfoAsync(int id, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None);
		#endregion
	}
}